import React, {useEffect} from 'react';
import {HashRouter, Route, Switch} from "react-router-dom";
import {Provider} from "react-redux";

import AppHeader from "@/components/app-header";
import AppFooter from "@/components/app-footer";

import Discover from "pages/discover";
import Mine from "pages/mine";
import Friends from "pages/friends";
import AppPlayerBar from "pages/player/app-player-bar";//导入我们的音乐播放器组件
// 用于全局显示

import store from './store';//我们在这里导入我们刚刚的store状态,
// 然后我们使用 Provider 组件进行包裹组件,让其在所有组件中都可以使用我们的状态
function App() {
  //这里我们取消让用户选择的权力，让用户无法选择文字
  useEffect(()=>{
      document.addEventListener('selectstart',(event)=>{
          event.preventDefault();
          
      });
  },[]);
  return (
      <Provider store={store}>
        <HashRouter>
          <AppHeader/>
          <Switch>
            <Route path="/discover" component={Discover}/>
            <Route path="/mine" component={Mine}/>
            <Route path="/friends" component={Friends}/>
          </Switch>
          <AppFooter/>
        <AppPlayerBar/>
        </HashRouter>
      </Provider>
  );
}

export default App;